package com.esun.server.controller;

import com.esun.api.interfaces.IExampleApi;
import com.esun.api.request.ExampleRequestDto;
import com.esun.common.annotation.OptLog;
import com.esun.common.response.RestResponse;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.List;


/**
 * 样例表(Example)控制类
 *
 * @author John.xiao
 * @date 2021-08-17 14:53:20
 */
@RestController
@RequestMapping("v1/example")
public class ExampleController implements IExampleApi {
	@Resource(name = "ExampleApi")
	IExampleApi exampleApi;

	@Override
	@OptLog(module = "样例模块",interfaceName = "分页查询样例数据")
	public RestResponse getExampleByPage(int pageIndex, int pageSize) {
		return exampleApi.getExampleByPage(pageIndex, pageSize);
	}

	@Override
	@OptLog(module = "样例模块",interfaceName = "添加样例信息")
	public RestResponse addExample(List<ExampleRequestDto> requestDtoList) {
		return exampleApi.addExample(requestDtoList);
	}

	@Override
	@OptLog(module = "样例模块",interfaceName = "更新样例信息")
	public RestResponse updateExample(List<ExampleRequestDto> requestDtoList) {
		return exampleApi.updateExample(requestDtoList);
	}

	@Override
	@OptLog(module = "样例模块",interfaceName = "删除样例信息")
	public RestResponse deleteExample(List<ExampleRequestDto> requestDtoList) {
		return exampleApi.deleteExample(requestDtoList);
	}

	@Override
	@OptLog(module = "样例模块",interfaceName = "待人样例信息")
	public RestResponse importExample(MultipartFile file) {
		return exampleApi.importExample(file);
	}

	@Override
	@OptLog(module = "样例模块",interfaceName = "导出样例信息")
	public void exportExample(ExampleRequestDto requestDto) {
		exampleApi.exportExample(requestDto);
	}

	@Override
	@OptLog(module = "样例模块",interfaceName = "下载样例信息模板")
	public void downloadTemplate(String path) {
		exampleApi.downloadTemplate(path);
	}
}